module.exports = {
  apps: [
    // First application
    {
      name: 'day-log-api',
      script: __dirname + '/dist/main.js',
      args: '',
      exec_mode: 'cluster',
      instances: 1,
      autorestart: true,
      watch: false,
      max_memory_restart: '1G',
      env_development: {
        NODE_ENV: 'development',
      },
      env_test: {
        NODE_ENV: 'test',
      },
      env_production: {
        NODE_ENV: 'production',
      },
    },
  ],

  deploy: {
    test: {
      user: 'root',
      host: 'ly_ser1',
      ref: 'origin/main',
      repo: 'git@gitee.com:bonn_admin/day-log-api.git',
      path: '/data/zpf/daylog/web-api',
      'pre-deploy-local': '',
      'post-deploy': 'supervisorctl restart daylog',
      'pre-setup': '',
    },
    production: {
      user: 'root',
      host: 'ly_prod',
      ref: 'origin/main',
      repo: 'git@gitee.com:bonn_admin/day-log-api.git',
      path: 'data/zpf/daylog/web-api',
      'pre-deploy-local': '',
      'post-deploy': 'npm run build && supervisorctl restart daylog ',
      'pre-setup': '',
    },
  },
}
